Carbon


GetSpecificFreeThreadCount

Header: Threads.h Carbon status: Supported

Determines how many threads with a stack size equal to or greater than the specified size are available to be allocated in a thread pool.

OSErr GetSpecificFreeThreadCount (
    ThreadStyle threadStyle, 
    Size stackSize, 
    SInt16 *freeCount
);
threadStyle

The type of thread to get information about. Cooperative is the only type that you can specify. Historically, the Thread Manger supported two types of threads, preemptive and cooperative, but the Thread Manager no longer supports preemptive threads.

stackSize

The stack size of the threads to get information about.

freeCount

On return, a pointer to the number of threads of the specified stack size available to be allocated.

function result

A result code.

DISCUSSION

The GetSpecificFreeThreadCount function determines how many threads with a stack size equal to or greater than the specified size are available to be allocated. Use this function instead of GetFreeThreadCount when you are interested not simply in the total number of available threads but when you want to know the number of available threads of a specified stack size as well.

The number of threads in the pool varies throughout execution of your application. Calls to the function CreateThreadPool add threads to the pool and calls to the function NewThread, when an existing thread is allocated, reduce the number of threads. You also add threads to the pool when you dispose of a thread with the DisposeThread function and specify that the thread be recycled.

To determine how many threads of any stack size are available, use the GetFreeThreadCount function.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when ThreadsLib 1.0 or later is installed. Exported by CarbonLib 1.0 and later and by ThreadsLib 1.0 and later.


© 2000 Apple Computer, Inc. — (Last Updated 3/8/2000)